package com.course.domain.vo;

import com.course.domain.pojo.CourseDetail;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class TreeCourseDetailVo extends CourseDetail {
    // 子节点
    private List<TreeCourseDetailVo> children;
    // 文章视频路径
    private String mediaUrls;
    // 视频时长 HH:mm:ss
    private String duration;
    public static TreeCourseDetailVo createTreeCourseDetailsDto(CourseDetail courseDetail){
        TreeCourseDetailVo treeCourseDetailsVo = new TreeCourseDetailVo();
        BeanUtils.copyProperties(courseDetail, treeCourseDetailsVo);
        treeCourseDetailsVo.setChildren(new ArrayList<>());
        return treeCourseDetailsVo;
    }
}
